class condorworknode::config inherits condorworknode {

  # $ifvirmacine
  $wrapper_file = '/etc/condor/wrapper/wrapper.sh' 
  $walltime_file = '/etc/condor/wrapper/walltime.txt'
  $special_walltime_file = '/etc/condor/wrapper/walltime_special.txt'
  $condor_common_file = '/etc/condor/config.d/worker_common_10.conf'
  $condor_post_file = '/etc/condor/config.d/worker_post_10.conf'

  file {'/etc/condor/wrapper':
    ensure   => "directory",
    owner    => 0,
    group    => 0,
    mode     => '0755',
  }->
  file { $walltime_file:
    ensure   => file,
    owner    => 0,
    group    => 0,
    mode     => '0644',
    source   =>  "puppet:///modules/condorworknode/walltime.txt",
  } ->

  file { $special_walltime_file:
    ensure   => file,
    owner    => 0,
    group    => 0,
    mode     => '0644',
    source   =>  "puppet:///modules/condorworknode/walltime_special.txt",
  } ->

  file { $wrapper_file:
    ensure   => file,
    owner    => 0,
    group    => 0,
    mode     => '0755',
    source   =>  "puppet:///modules/condorworknode/wrapper.sh",
  } ->

  file { "/etc/condor/wrapper/exp_group.json":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/exp_group.json",
  } ->

  file { $condor_common_file:
    ensure   => file,
    owner    => 0,
    group    => 0,
    mode     => '0644',
    source   =>  "puppet:///modules/condorworknode/worker_common_10.conf",
    notify  => Exec['reconfig_condor']
  } ->

  file { $condor_post_file:
    ensure   => file,
    owner    => 0,
    group    => 0,
    mode     => '0644',
    content => template("${module_name}/worker_post_10.erb"),
    notify  => Exec['reconfig_condor']
  }

  file { '/etc/condor/config.d/worker-common-10.conf':
    ensure   => absent,
  }

  file { '/etc/condor/config.d/worker-post-10.conf':
    ensure   => absent,
  }

  file { '/etc/condor/config.d/worker.conf':
    ensure   => absent,
  }

  file { '/etc/condor/config.d/x_worker.conf':
    ensure   => absent,
  }

  exec {'reconfig_condor':
    command      => "/usr/sbin/condor_reconfig",
    refreshonly  => true
  }

  exec {'restart_condor':
    command      => "/sbin/service condor restart",
    refreshonly  => true
  }

}
